const app = getApp();
import axios from '../../../../utils/axios'
Page({
  data: {
    textareaVal: ''
  },
  onLoad: function (options) {

  },
  onReady: function () {

  },
  // 更新反馈内容
  updateFeedBack(e) {
    this.setData({
      textareaVal: e.detail.value
    });
  },
  // 提交反馈
  async subFeedBack() {
    let userInfo = app.globalData.userInfo;
    let res = await axios({
      url: '/api/custom/complaint/self',
      data: {
        customId: userInfo.id,
        customPhone: userInfo.phoneNumber,
        customName: userInfo.nickName,
        content: this.data.textareaVal
      },
      header: {
        'Authorization': wx.getStorageSync('token')
      }
    });
    console.log(res);
    wx.showToast({
      title: '反馈提交成功',
      icon: 'success',
      duration: 1500,
    });
    this.setData({
      textareaVal: ''
    })
  }
})